import request from '@/utils/request'

// 添加
export function addEmployee(data) {
  return request({
    url: '/employee',
    method: 'post',
    data
  })
}
export function addJob(data) {
  return request({
    url: '/employee/job',
    method: 'post',
    data
  })
}
export function addPrize(data) {
  return request({
    url: '/employee/prize',
    method: 'post',
    data
  })
}
export function addEdu(data) {
  return request({
    url: '/employee/edu',
    method: 'post',
    data
  })
}
export function addProject(data) {
  return request({
    url: '/employee/project',
    method: 'post',
    data
  })
}

// 查询
export function getEmployees(data, offset, limit) {
  return request({
    url: '/employee',
    method: 'get',
    params: {
      name: data.name,
      userId: data.userId,
      status: data.status,
      offset: offset,
      limit: limit
    }
  })
}
export function getMyEmployee() {
  return request({
    url: '/employee/mine',
    method: 'get'
  })
}
export function getJobs(id) {
  return request({
    url: `/employee/job/${id}`,
    method: 'get'
  })
}
export function getPrizes(id) {
  return request({
    url: `/employee/prize/${id}`,
    method: 'get'
  })
}
export function getEducations(id) {
  return request({
    url: `/employee/edu/${id}`,
    method: 'get'
  })
}
export function getProjects(id) {
  return request({
    url: `/employee/project/${id}`,
    method: 'get'
  })
}

// 修改
export function modifyEmployee(data) {
  return request({
    url: '/employee',
    method: 'put',
    data
  })
}
export function modifyPrize(data) {
  return request({
    url: '/employee/prize',
    method: 'put',
    data
  })
}
export function modifyJob(data) {
  return request({
    url: '/employee/job',
    method: 'put',
    data
  })
}
export function modifyEducation(data) {
  return request({
    url: '/employee/edu',
    method: 'put',
    data
  })
}
export function modifyProject(data) {
  return request({
    url: '/employee/project',
    method: 'put',
    data
  })
}

// 删除
export function removeJob(id) {
  return request({
    url: `/employee/job/${id}`,
    method: 'delete'
  })
}
export function removePrize(id) {
  return request({
    url: `/employee/prize/${id}`,
    method: 'delete'
  })
}
export function removeProject(id) {
  return request({
    url: `/employee/project/${id}`,
    method: 'delete'
  })
}
export function removeEducation(id) {
  return request({
    url: `/employee/edu/${id}`,
    method: 'delete'
  })
}
